<?php

namespace App\Models;

use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\DB;
use Laravel\Passport\HasApiTokens;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Permission\Traits\HasRoles;
use App\Notifications\ResetPasswordNotification;

class Cartoon extends Authenticatable
{

    use HasApiTokens,Notifiable;


    protected $table = 'cartoon';

    protected $fillable = ['name','img','member_id','status','text','label'];

//    protected $hidden = ['password','remember_token'];
    public    $timestamps = 1;
    protected $primaryKey = 'id';
    /**
     * 返回用户数据
     * @param $id
     * @return mixed
     */
    public function getData($where){
        return self::where($where)
                ->first();
    }
    /**
     * 返回列表数据
     * @param $id
     * @return mixed
     */
    public function getList($where,$num)
    {
        return self::where($where)
            ->orderBy('id','desc')->paginate($num)->toArray();
    }


    /**
     * 返回用户详细数据
     * @param $id
     * @return mixed
     */
    public function shows($id){

        return self::where(['id'=>$id])
            ->first();
    }


}
